package cn.auan.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.Locale;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.ui.Model;


/**
 * @author 十三月
 * @Description
 * @date 2018-08-02 下午4:57
 */
@Controller
public class IndexController {

    @Autowired
    private MessageSource messageSource;

    @RequestMapping("/")
    public String hello(Model model){

        Locale locale = LocaleContextHolder.getLocale();
        model.addAttribute("welcome", messageSource.getMessage("welcome", null, locale));

        return "index";
    }
}